package com.bibrApp.difu.fragment.jiedai_mvp;

import androidx.annotation.NonNull;

import com.bibrApp.difu.R;
import com.bibrApp.difu.Response.C2CJiedaiResBody;
import com.bibrApp.difu.utils.BigdecimalUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.ArrayList;

public class JiedaiAdapter extends BaseQuickAdapter<C2CJiedaiResBody.JiedaiBean, BaseViewHolder> {
    public JiedaiAdapter() {
        super(R.layout.item_jiedai, new ArrayList<>());
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, C2CJiedaiResBody.JiedaiBean bean) {

        helper.addOnClickListener(R.id.tv_jiechu);
        helper.setText(R.id.item_name,bean.getNickname())
                .setText(R.id.item_totlemoney,bean.getLegalQuantity())
                .setText(R.id.item_zrate, BigdecimalUtils.format2Str(Double.parseDouble(bean.getPawnRate())*100,0)+"%")
                .setText(R.id.item_yearrate,BigdecimalUtils.format2Str((Double.parseDouble(bean.getLegalDailyRate())*365*100),2)+"%")
                .setText(R.id.item_zname,"质押物("+bean.getPawnCoinEunit()+")")
                .setText(R.id.item_day,bean.getCycle())
                .setText(R.id.item_day_rate,BigdecimalUtils.format2Str(Double.parseDouble(bean.getLegalDailyRate())*100,4)+"%");

    }
}
